#pragma once
#include "ElementNode.h"
#include "math.h"
#include "grid3x3.h"

namespace NBGUI
{
	class GUIAPI MenuItem: public ElementNode, public Grid3x3
	{
	public:
		enum MenuItemState
		{
			Hide = 0,
			UnSeleted,
			Selected,
			open,
			closed
			
		};
		MenuItem(GUIDrawer* drawer, const char* name, const char* eleText, int eleType = NONE, Rect& _rect = Rect(), bool click = false );
		MenuItem(GUIDrawer* drawer, const char* name, const char* eleText, vec2f* uv, int eleType = NONE, Rect& _rect = Rect(), bool click = false );
		~MenuItem();

		void buildVI(std::vector<Vertex>* vertices, std::vector<unsigned int>* indices,unsigned int screenWidth, unsigned int screenHeight);

		void draw();
		void handleEvent(Event* e);
		void openMenu();
	protected:
		vec2f uv[8];//selected or unselected
		int state;
		bool needClick;//need click to open ? or just select
	};
}